<table class="table table-striped caption-top w-auto">
    <caption>
        {{- 'Search results for "<em>%s</em>" %s:'|format(
            criteria_search_string|e,
            search_type_description
        )|raw -}}
    </caption>
    {% for row in rows %}
        <tr class="noclick">
            <td>
                {%- set result_message -%}
                    {% trans %}
                        %1$s match in <strong>%2$s</strong>
                    {% plural row.result_count %}
                        %1$s matches in <strong>%2$s</strong>
                    {% endtrans %}
                {%- endset -%}
                {{- result_message|format(row.result_count, row.table|e)|raw -}}
            </td>
            {%- if row.result_count > 0 -%}
                {%- set url_params = {
                    'db': db,
                    'table': row.table,
                    'goto': url('/database/sql'),
                    'pos': 0,
                    'is_js_confirmed': 0
                } -%}
                <td><button
                        class="btn btn-link p-0 ajax browse_results"
                        data-href="{{ url('/sql', url_params) }}"
                        data-browse-sql="{{ row.new_search_sqls.select_columns }}"
                        data-table-name="{{ row.table }}">{% trans 'Browse' %}</button>
                </td>
                <td><button
                        class="btn btn-link p-0 ajax delete_results"
                        data-href="{{ url('/sql', url_params) }}"
                        data-delete-sql="{{ row.new_search_sqls.delete }}"
                        data-table-name="{{ row.table }}">{% trans 'Delete' %}</button>
                </td>
            {%- else -%}
                <td></td>
                <td></td>
            {%- endif -%}
        </tr>
    {% endfor %}
</table>

{% if criteria_tables|length > 1 %}
    <p>
        {% trans %}
            <strong>Total:</strong> <em>{{ count }}</em> match
        {% plural result_total %}
            <strong>Total:</strong> <em>{{ count }}</em> matches
        {% endtrans %}
    </p>
{% endif %}
